<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <link rel="shortcut icon" href="../../src/images/bitbug_favicon.ico" type="image/x-icon">
  <meta name="keywords" content="your keywords">
  <meta name="description" content="your description">
  <meta name="author" content="author,email address">
  <meta name="robots" content="index,follow">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <title>仁和区党群服务一号通暨群众意见受理中心</title>
  <link rel="stylesheet" href="../../src/css/base.css">
  <link rel="stylesheet" href="../../src/css/common.css">
  <link rel="stylesheet" href="../../src/css/tpl.css">
  <link rel="stylesheet" href="../../src/css/user_center.css">
    <script src="../../src/js/libs/es5-shim.min.js"></script>   <script src="../../src/js/libs/es5-sham.min.js"></script>    <script src="../../src/js/libs/json3.min.js"></script> </head>

<body>
  <div class="page">
    <div id="header">
    </div>
    <div class="menu-bar">
      <div class="container">
        <span>
        <span class="crumb-name">当前你的位置：</span>>
        </span>
        <span>
             <a href="../Home/Index.html">首页</a>>
      </span>
        <span>个人中心</span>
      </div>
    </div>

    <div class="mid_container clearfix">
      <div class="left_guide">
        <h1 class="left_guide_top_size">
          个人中心
        </h1>
        <div class="left_guide_decorate">
        </div>
        <div class="left_about_us">
          ABOUT US
        </div>
        <div class="left_white_about">
          <a href="../Personal/LeaveMessage.html">
              <span class="left_cn_about_us">系统消息</span>
            </a>
        </div>
        <div class="left_white_about">
          <a href="../Personal/Collect.html">
              <span class="left_cn_about_us">我的收藏</span>
            </a>
        </div>
        <div class="left_white_about">
          <a href="../Personal/Work.html">
              <span class="left_cn_about_us">我的工作</span>
            </a>
        </div>
        <div class="left_white_about active">
          <a href="../Personal/set.html">
              <span class="left_cn_about_us">修改密码</span>
            </a>
        </div>
      </div>
      <div class="mid_guide">
        <div class="mid_guide_content">
          <div class="audit_content">
            <div class="audit_title title_3">修改密码</div>
            <div class="audit_info">
              <div class="audit_info_row set clearfix">
                <div class="fl left">旧密码：</div>
                <div class="right">
                  <input type="password" placeholder="" id="last_password">
                </div>
              </div>
              <div class="audit_info_row set clearfix">
                <div class="fl left">新密码：</div>
                <div class="right">
                  <input type="password" placeholder="" id="new_password">
                </div>
              </div>
              <div class="audit_info_row set clearfix">
                <div class="fl left">确认密码：</div>
                <div class="right">
                  <input type="password" placeholder="" id="que_password">
                </div>
              </div>
              <div class="audit_info_row set clearfix">
                <div class="fl left"></div>
                <div class="right">
                  <input type="button" value="提交" class="butt red" onclick="EditPassword()">
                  <input type="button" value="取消" class="butt gray" onclick="cancel
                  ()">
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div id="footer">
  </div>
  <script src="../../src/js/libs/jquery.1.12.4.js"></script>
  <script src="../../src/js/libs/layer/layer.js"></script>
  <script src="../../src/js/base/common.js"></script>
  <script>
    var pageindex = 6


    var id = document.cookie.split(";")[1].split("=")[1]

    function EditPassword() {


      if ($.trim($('#last_password').val()) == "" || $.trim($('#new_password').val()) == "") {
        layer.msg("请将信息填写完整！");
        return;
      }
      if ($.trim($('#new_password').val()).length > 12 || $.trim($('#new_password').val()).length < 8) {
        layer.msg("请设置8-12位密码！");
        return;
      }
      if ($('#que_password').val() != $('#new_password').val()) {
        layer.msg("两次密码不一样！");
        return;
      }

      var lastpwd = $.trim($('#last_password').val());
      var newpwd = $.trim($('#new_password').val());


      var data = {
        "Id": id,
        "newpassword": newpwd,
        "lastpassword": lastpwd
      }

      $.ajax({
        type: "POST",
        url: "http://221.10.2.222:5680/api/ow/Consumers/UpdatePassword",
        dataType: "json",
        data: data,
        success: function (data) {

          switch (data) {
            case -1:
              layer.msg("修改失败");
              break;
            case 0:
              layer.msg("修改成功,请重新登录", {
                time: 1500
              }, function () {
                $('#que_password').val("");
                $('#new_password').val("");
                $('#last_password').val("");
                $("#editpassword").hide();
                singout();
              });
              break;
            case -2:
              layer.msg("原密码错误！请重新输入！");
              break;
          }
        }
      });
    }
  </script>
</body>

</html>